package wa.persist;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import wa.domain.Artifact;

@Stateless
public class ArtifactDAO {

	@PersistenceContext(unitName = "derbyPU")
	public EntityManager em;
	
	public List<Artifact> findSoftware() {
		return em.createNamedQuery("findAllArtifacts", Artifact.class).getResultList();
	}
	
	public Artifact create(Artifact artifact){
		em.persist(artifact);
		return artifact;
	}
}
